<!--
  To change this template, choose Tools | Templates
  and open the template in the editor.
-->

<%@ page contentType="text/html;charset=UTF-8" %>

<html>
  <head>
    <meta name="layout" content="main">
    <title>Mis Tareas</title>
  </head>
  <body>
    <h1>Mis Tareas</h1>
    
    <table>
      <tr>
        <th>Nombre</th>
        <th>Descripción</th>
        <th></th>
      </tr>
      <g:each in="${usuario.tareas}" status="i" var="tareaInstance">
        <g:if test="${tareaInstance.estado.id == 2}">
      <tr>
        <td>${tareaInstance.nombre}</td>
        <td>${tareaInstance.descripcion}</td>
        <td><g:link controller="tarea" action="show" id="${tareaInstance?.id}">Ver Detalles</g:link></td>
      </tr>
        </g:if>
      </g:each>
    </table>
    
    <h1>Mis Tareas Pendientes</h1>
    
    <table>
      <tr>
        <th>Nombre</th>
        <th>Descripción</th>
        <th></th>
      </tr>
      <g:each in="${usuario.tareas}" status="i" var="tareaInstance">
        <g:if test="${tareaInstance.estado.id == 1}">
      <tr>
        <td>${tareaInstance.nombre}</td>
        <td>${tareaInstance.descripcion}</td>
        <td><g:link controller="tarea" action="show" id="${tareaInstance?.id}">Tomar Tarea</g:link></td>
      </tr>
        </g:if>
      </g:each>
    </table>
    
    <h1>Mis Tareas sin Calificar</h1>
    
    <table>
      <tr>
        <th>Nombre</th>
        <th>Descripción</th>
        <th></th>
      </tr>
      <g:each in="${usuario.tareas}" status="i" var="tareaInstance">
        <g:if test="${tareaInstance.estado.id == 3}">
      <tr>
        <td>${tareaInstance.nombre}</td>
        <td>${tareaInstance.descripcion}</td>
        <td><g:link controller="calificacion" action="create" id="${tareaInstance?.id}">Calificar</g:link></td>
      </tr>
        </g:if>
      </g:each>
    </table>
  </body>
</html>